﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using System.ComponentModel;

namespace MvcApplication2.Models
{
    [MetadataType(typeof(ScoreMetadata))]//метаданные для класса Highereducation содержатся внутри этого класса
    public partial class Score //является частью класса Highereducation
    {
        [Bind(Exclude = "id")]//не валидируем id
        public class ScoreMetadata
        {
            [ScaffoldColumn(false)]
            public int id { get; set; }//доступно для чтения и записи

            [DisplayName("year")]
            [DisplayFormat(ApplyFormatInEditMode = true)]
            [Required(ErrorMessage = "Score year is required.")]
            [Range(1900, 2020, ErrorMessage = "Score name must be 1900 between 2020.")]
            public int year { get; set; }

            [DisplayName("point")]
            [DisplayFormat(ApplyFormatInEditMode = true)]
            [Required(ErrorMessage = "Score point is required.")]
            [Range(1, 300, ErrorMessage = "Score name must be 1 between 300.")]
            public int point { get; set; }
        }
    }
}